/**
 * 
 */
package edu.arizona.bio5.onto.util;

import java.io.File;
import java.util.HashSet;
import java.util.Set;

import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.io.OWLXMLOntologyFormat;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyManager;

/**
 *
 *
 * (c) Pavel Klinov
 *
 */
public class WeirdOntologyGenerator {

	static final String ONTO_URI = "http://www.weird.stuff.org";
	
	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {

		OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
		Set<OWLAxiom> axioms = generateWeirdAxioms(manager.getOWLDataFactory());
		OWLOntology ontology = manager.createOntology(axioms, IRI.create(ONTO_URI));
		
		manager.saveOntology(ontology, new OWLXMLOntologyFormat(), IRI.create(new File("test_data/onto/weird_onto.owl").toURI()));
	}

	private static Set<OWLAxiom> generateWeirdAxioms(OWLDataFactory factory) {
		
		Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
		
		for (int i = 1; i <= 30; i++) {
			
			axioms.add(factory.getOWLSubClassOfAxiom(
					factory.getOWLClass(IRI.create("http://www.weird.stuff.org#A" + i)),
					factory.getOWLClass(IRI.create("http://www.weird.stuff.org#A" + (i+1)))));
		}
		
		return axioms;
	}

}
